package com.inspire.tank;

import java.awt.*;

/**
 * @author inspire
 * @description
 * @date 2022/6/3 20:01
 */
public class Explode extends GameObject{
    public static int WIDTH = ResourceMgr.getInstance().explodes[0].getWidth();
    public static int HEIGHT = ResourceMgr.getInstance().explodes[0].getHeight();

    private int x, y;

    private TankFrame tf=null;

    private int step=0;

    public Explode(int x, int y) {
        this.x = x;
        this.y = y;
        GameModel.getInstance().add(this);
    }

    public void paint(Graphics g) {

        g.drawImage(ResourceMgr.getInstance().explodes[step++],x,y,null);

        if(step>=ResourceMgr.getInstance().explodes.length){
            GameModel.getInstance().remove(this);
            step=0;
        }
    }

    @Override
    public int getWidth() {
        return WIDTH;
    }

    @Override
    public int getHeight() {
        return HEIGHT;
    }

}
